home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 February: Tool Chest / Dev.CD Feb 94.toast / Tool Chest / Development Platforms / MPW Related / MPW Interfaces / CIncludes / Processes.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-17  |  5.2 KB  |  185 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        Processes.h
  3.  
  4.     Copyright:    © 1983-1993 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Version:    System 7.1 for ETO #11
  8.     Created:    Tuesday, March 30, 1993 18:00
  9.  
  10. */
  11.  
  12. #ifndef __PROCESSES__
  13. #define __PROCESSES__
  14.  
  15. #ifndef __TYPES__
  16. #include <Types.h>
  17. #endif
  18.  
  19. #ifndef __EVENTS__
  20. #include <Events.h>
  21. #endif
  22.  
  23. #ifndef __FILES__
  24. #include <Files.h>
  25. #endif
  26.  
  27.  
  28. /* type for unique process identifier */
  29. struct ProcessSerialNumber {
  30.     unsigned long highLongOfPSN;
  31.     unsigned long lowLongOfPSN;
  32. };
  33.  
  34. typedef struct ProcessSerialNumber ProcessSerialNumber;
  35. typedef ProcessSerialNumber *ProcessSerialNumberPtr;
  36.  
  37.  
  38. enum {
  39.  
  40.  
  41. /*************************************************************************
  42.  *                            Process identifier.
  43.  ************************************************************************
  44.  Various reserved process serial numbers. */
  45.  
  46.     kNoProcess = 0,
  47.     kSystemProcess = 1,
  48.     kCurrentProcess = 2
  49. };
  50.  
  51. /**********************************************************************************************************************************************
  52.  *        Definition of the parameter block passed to _Launch.
  53.  *************************************************************************
  54.  
  55. * Typedef and flags for launchControlFlags field */
  56. typedef unsigned short LaunchFlags;
  57.  
  58. enum {
  59.  
  60.  
  61. /*************************************************************************
  62.  *        Definition of the parameter block passed to _Launch.
  63.  *************************************************************************/
  64.  
  65.     launchContinue = 0x4000,
  66.     launchNoFileFlags = 0x0800,
  67.     launchUseMinimum = 0x0400,
  68.     launchDontSwitch = 0x0200,
  69.     launchAllow24Bit = 0x0100,
  70.     launchInhibitDaemon = 0x0080
  71. };
  72.  
  73. /* Format for first AppleEvent to pass to new process.  The size of the overall
  74.  * buffer variable: the message body immediately follows the messageLength.
  75.  */
  76. struct AppParameters {
  77.     EventRecord theMsgEvent;
  78.     unsigned long eventRefCon;
  79.     unsigned long messageLength;
  80. };
  81.  
  82. typedef struct AppParameters AppParameters;
  83. typedef AppParameters *AppParametersPtr;
  84.  
  85. /* Parameter block to _Launch */
  86. struct LaunchParamBlockRec {
  87.     unsigned long reserved1;
  88.     unsigned short reserved2;
  89.     unsigned short launchBlockID;
  90.     unsigned long launchEPBLength;
  91.     unsigned short launchFileFlags;
  92.     LaunchFlags launchControlFlags;
  93.     FSSpecPtr launchAppSpec;
  94.     ProcessSerialNumber launchProcessSN;
  95.     unsigned long launchPreferredSize;
  96.     unsigned long launchMinimumSize;
  97.     unsigned long launchAvailableSize;
  98.     AppParametersPtr launchAppParameters;
  99. };
  100.  
  101. typedef struct LaunchParamBlockRec LaunchParamBlockRec;
  102. typedef LaunchParamBlockRec *LaunchPBPtr;
  103.  
  104.  
  105. enum {
  106.  
  107.  
  108. /* Set launchBlockID to extendedBlock to specify that extensions exist.
  109. * Set launchEPBLength to extendedBlockLen for compatibility.*/
  110.  
  111.  
  112. #define extendedBlock ((unsigned short)'LC')
  113. #define extendedBlockLen (sizeof(LaunchParamBlockRec) - 12)
  114.  
  115. /*************************************************************************
  116.  * Definition of the information block returned by GetProcessInformation
  117.  ************************************************************************
  118.  Bits in the processMode field */
  119.  
  120.  
  121.     modeDeskAccessory = 0x00020000,
  122.     modeMultiLaunch = 0x00010000,
  123.     modeNeedSuspendResume = 0x00004000,
  124.     modeCanBackground = 0x00001000,
  125.     modeDoesActivateOnFGSwitch = 0x00000800,
  126.     modeOnlyBackground = 0x00000400,
  127.     modeGetFrontClicks = 0x00000200,
  128.     modeGetAppDiedMsg = 0x00000100,
  129.     mode32BitCompatible = 0x00000080,
  130.     modeHighLevelEventAware = 0x00000040,
  131.     modeLocalAndRemoteHLEvents = 0x00000020,
  132.     modeStationeryAware = 0x00000010,
  133.     modeUseTextEditServices = 0x00000008
  134. };
  135.  
  136. /* Record returned by GetProcessInformation */
  137. struct ProcessInfoRec {
  138.     unsigned long processInfoLength;
  139.     StringPtr processName;
  140.     ProcessSerialNumber processNumber;
  141.     unsigned long processType;
  142.     OSType processSignature;
  143.     unsigned long processMode;
  144.     Ptr processLocation;
  145.     unsigned long processSize;
  146.     unsigned long processFreeMem;
  147.     ProcessSerialNumber processLauncher;
  148.     unsigned long processLaunchDate;
  149.     unsigned long processActiveTime;
  150.     FSSpecPtr processAppSpec;
  151. };
  152.  
  153. typedef struct ProcessInfoRec ProcessInfoRec;
  154. typedef ProcessInfoRec *ProcessInfoRecPtr;
  155.  
  156.  
  157. #ifdef __cplusplus
  158. extern "C" {
  159. #endif
  160. #pragma parameter __D0 LaunchApplication(__A0)
  161. pascal OSErr LaunchApplication(const LaunchParamBlockRec *LaunchParams)
  162.     = 0xA9F2; 
  163. pascal OSErr LaunchDeskAccessory(const FSSpec *pFileSpec,ConstStr255Param pDAName)
  164.     = {0x3F3C,0x0036,0xA88F}; 
  165. pascal OSErr GetCurrentProcess(ProcessSerialNumber *PSN)
  166.     = {0x3F3C,0x0037,0xA88F}; 
  167. pascal OSErr GetFrontProcess(ProcessSerialNumber *PSN)
  168.     = {0x70FF,0x2F00,0x3F3C,0x0039,0xA88F}; 
  169. pascal OSErr GetNextProcess(ProcessSerialNumber *PSN)
  170.     = {0x3F3C,0x0038,0xA88F}; 
  171. pascal OSErr GetProcessInformation(const ProcessSerialNumber *PSN,ProcessInfoRecPtr info)
  172.     = {0x3F3C,0x003A,0xA88F}; 
  173. pascal OSErr SetFrontProcess(const ProcessSerialNumber *PSN)
  174.     = {0x3F3C,0x003B,0xA88F}; 
  175. pascal OSErr WakeUpProcess(const ProcessSerialNumber *PSN)
  176.     = {0x3F3C,0x003C,0xA88F}; 
  177. pascal OSErr SameProcess(const ProcessSerialNumber *PSN1,const ProcessSerialNumber *PSN2,
  178.     Boolean *result)
  179.     = {0x3F3C,0x003D,0xA88F}; 
  180. #ifdef __cplusplus
  181. }
  182. #endif
  183.  
  184. #endif
  185.